package UT01.extra;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class PalabraMasLarga {
	
	public static void main(String[] arg) {

	File file = new File("D:\\prueba.txt");
	Scanner sc = null;
	String palabra = "";
	String palabraMasLarga = "";
	try {
		sc = new Scanner(new FileInputStream(file));
	} catch (FileNotFoundException e) {	
		e.printStackTrace();
	}
	int count=0;
	while(sc.hasNext()){
		palabra = sc.next();
		if (palabra.length()>palabraMasLarga.length()) {
			palabraMasLarga = palabra;
		}
			
	    count++;
	}
	System.out.println("N�mero de palabras: " + count);
	System.out.println("Palabra m�s larga: " + palabraMasLarga +" de "+palabraMasLarga.length()+" letras");
	}
}

